package com.learn.other;

import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext;


// Generated by https://start.springboot.io
// 优质的 spring/boot/data/security/cloud 框架中文文档尽在 => https://springdoc.cn

/**
 * 打成war包：
 * 1. 继承 SpringBootServletInitializer
 * 2. 重写configure()
 */
@SpringBootApplication
@MapperScan("com.learn.other.mapper")
@Log4j2
public class Ch06OtherApplication extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Ch06OtherApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(Ch06OtherApplication.class, args);
       /* // 通过代码方式设定, yaml的优先级更高
        SpringApplication application = new SpringApplication(Ch06OtherApplication.class);
        application.setBannerMode(Banner.Mode.OFF);
        application.run(args);*/

        /*ConfigurableApplicationContext applicationContext = new SpringApplicationBuilder()
                .sources(Ch06OtherApplication.class)
                .bannerMode(Banner.Mode.OFF)
                .run(args);*/
        log.trace("===> trace logging");
        log.debug("===> debug logging");
        log.info("===> info logging");
        log.warn("===> warn logging");
        log.error("===> error logging");
    }

}
